

function JTextWidget (options){
	
	JWidget.apply(this,arguments);
}
JTextWidget.prototype.__proto__ = JWidget.prototype;

JTextWidget.prototype.init = function(){
	/*
	 * 调用父类方法
	 */
	 
 	JWidget.prototype.init.apply(this,arguments);
 	
 	if(typeof this.fields.text == 'undfined'){
		this.fields.text ='';
	}
 	
 	var me = this;
	var fontSizeOption  = {
			value:16,
			min:10,
			max:40,
			slide:function(event, ui){
					$name =  $(this).attr('name');
					me.dom.css($name,  ui.value +'px'); 
				},
			stop:function(event, ui){
					$name =  $(this).attr('name');
					me.style ($name , ui.value +'px');
				}
		};
	
	var dropDownFamily = $('<select/>').addClass('dropDownFamily').append($('<option/>').attr('value','宋体').text('宋体'))
										.append($('<option/>').attr('value','黑体').text('黑体'))
										.append($('<option/>').attr('value','微软雅黑').text('微软雅黑'))
										.append($('<option/>').attr('value','楷体').text('楷体'))
										.append($('<option/>').attr('value','Arial').text('Arial'))
										.append($('<option/>').attr('value','Arial Black').text('Arial Black'))
										.append($('<option/>').attr('value','Times New Roman').text('Times New Roman'))
						.css({width:'80px'})
						.change(function(){
							me.style('font-family',this.value );
							me.dom.css('font-family', this.value ); 
							
						});
	var fontColor =$('<div><div/>').addClass('colorbutton').click(function(){me.pickerColor(this,'color');});
	
	var textArea = $('<textarea></textarea>').text('写点什么吧!!')
 	                       .click(function(){if(this.value == '写点什么吧!!'){this.value = '';} return false;})
 	                       	.css({border:'1px solid',width:'98%','min-height':'100px'}).keyup(function(){
								me.dom.find('.text').html($(this).val());
							}).blur(function(){
								me.field('text', $(this).val());
							});
	if(this.fields.text){
		textArea.text(this.fields.text);
	}				
	
 	var textConfigItems = [textArea,
							$("<div></div>").addClass('row')
							.append($('<div></div>').addClass('slider').attr('name','font-size').slider(fontSizeOption))
							.append($('<div></div>').css({'float':'left',padding:'5px 20px',height: '30px','line-height': '30px'}).append(dropDownFamily))
							.append(fontColor)
						   
	];
 	
 	
	this.configItems = $.extend(true,textConfigItems ,this.configItems);

 
};

JTextWidget.prototype.run = function(){
	
	/*
	 * 调用父类方法
	 */
 	JWidget.prototype.run.apply(this,arguments);
// 	
 	this.core.addClass('text').append(this.fields.text);
	
 	
 	
 	
};


/*
 * 事件
 */
JWidget.prototype.resized = function(event, ui){};
JWidget.prototype.draged = function(event, ui){};
JWidget.prototype.move = function(event, ui ){}; 
JWidget.prototype.click = function(){}; 
JWidget.prototype.load = function(){};
JWidget.prototype.beforeSave = function(){ return true;};
  
